widget: Add a private setter for has-focus
authorMatthias Clasen <mclasen@redhat.com>
Thu, 7 Mar 2019 03:26:27 +0000 (22:26 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 17 Mar 2019 01:24:44 +0000 (21:24 -0400)
gtk/gtkwidget.c
gtk/gtkwidgetprivate.h

index 2d76855c427d4f1abc6d7a90a51a88756bc19e65..c5eb6d63cb2980f9023a6252c5b0f4fcfbc6766f 100644 (file)
@@ -11623,6 +11623,19 @@ gtk_widget_send_focus_change (GtkWidget *widget,
   return TRUE;
 }
 
+void
+gtk_widget_set_has_focus (GtkWidget *widget,
+                          gboolean   has_focus)
+{
+  GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
+
+  if (priv->has_focus == has_focus)
+    return;
+
+  priv->has_focus = has_focus;
+  g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_HAS_FOCUS]);
+}
+
 /**
  * gtk_widget_in_destruction:
  * @widget: a #GtkWidget
index 314d793090ff3dc6c6fc9a521825736f0f08c512..ca30e9b0f3dfebbc87237b473cf03f451b6f7453 100644 (file)
@@ -318,6 +318,8 @@ void              gtk_widget_focus_sort                    (GtkWidget        *wi
                                                             GPtrArray        *focus_order);
 gboolean          gtk_widget_focus_move                    (GtkWidget        *widget,
                                                             GtkDirectionType  direction);
+void              gtk_widget_set_has_focus                 (GtkWidget        *widget,
+                                                            gboolean          has_focus);
 void              gtk_widget_get_surface_allocation         (GtkWidget *widget,
                                                             GtkAllocation *allocation);